package com.fenyin.samples.study.securty;  

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
  
public class URLEncoder {
	
	public static void main(String[] args) throws UnsupportedEncodingException{
		   String keyWord = URLDecoder.decode("%E5%85%B6%E4%BB%96%E5%93%81%E7%89%8C", "UTF-8");
	       System.out.println(keyWord);

	       //将普通字符串转换成
	       //application/x-www-form-urlencoded字符串
	       //必须强调的是编码方式必须正确，如baidu的是gb2312，而google的是UTF-8
	       String urlStr = java.net.URLEncoder.encode("其他品牌", "UTF-8");
	       System.out.println(urlStr);
	}
}
